import request from "@/utils/request";

function getRoleListRes(page,limit){
    return request.get("/admin/acl/role/"+`${page}/${limit}`)
}

// 新增角色
function addRoleRes(data){
    if(data.id){
        return request.put("/admin/acl/role/update",data);
    }else{
        return request.post("/admin/acl/role/save",data)
    }   
}
// 根据角色id获取权限菜单
function getRolePermissionRes(roleId){
    return request.get("/admin/acl/permission/toAssign/"+roleId)
}
// 给角色分配权限
function setRolePermissionRes(roleId,permissionId){
    return request.post("/admin/acl/permission/doAssign",{},{
        params:{
            roleId,
            permissionId
           
        }

    })
}
//更新
function updateRes(data){
    return request.put("/admin/acl/role/update",data)
}



export default {
    getRoleListRes,
    addRoleRes,
    getRolePermissionRes,
    setRolePermissionRes,
    updateRes
}